package QL;

import java.util.List;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class ButlerMailGiftLogQueryResponse extends BaseQLResponse
{
    /// <summary>
    /// 总数量
    /// </summary>
    public long TotalCount;

    /// <summary>
    /// 日志列表
    /// </summary>
    public List<ButlerMailGiftLog> LogItems;

    @Override
    public void DeserializeFromJson(JSONObject jsonObj)
    {
        JSONObject t = jsonObj.getJSONObject("error_response");
        if (t != null && !t.isNullObject())
        {
            ErrCode = t.getString("code");
            ErrMsg = t.getString("msg");
        }
        else
        {
            t = jsonObj.getJSONObject("butler_mail_gift_log_query_response");
            if (t.has("total_count"))
                TotalCount = t.getLong("total_count");
            LogItems = new ArrayList<ButlerMailGiftLog>();
            JSONArray arrLogItems = t.getJSONObject("log_items").getJSONArray("butler_mail_gift_log");
            for (int i = 0; i < arrLogItems.size(); ++i)
            {
                ButlerMailGiftLog o = new ButlerMailGiftLog();
                o.DeserializeFromJson(arrLogItems.getJSONObject(i));
                LogItems.add(o);
            }
        }
    }
}
